package group

import (
	"common/mildware"
	"common/router"
	"github.com/gin-gonic/gin"
	"project/pkg/dao/mysql"
	"project/pkg/dao/redis"
)

type GRouter struct {
}
type GHandler struct {
	M mysql.Mysql
	R redis.Redis
}

func NewGHandler() *GHandler {
	return &GHandler{
		M: mysql.NewMysql(),
		R: redis.NewRedis(),
	}
}
func init() {
	router.AddRouter(new(GRouter))
}
func (GRouter) Router(e *gin.Engine) {
	handler := NewGHandler()
	group := e.Group("group")
	group.POST("update", handler.UpdateGroupInfo)
	group.POST("people/add", handler.AddPeopleToGroup)
	group.POST("del", handler.DelGroup)
	group.Use(mildware.JWTAuthMiddleware())
	group.POST("add", handler.CreateGroup)
	group.POST("all", handler.GetAllGroup)
}
